knitr::opts_chunk$set(echo = TRUE)
A <- replicate(10000,sum(rbinom(20,1,.05))) hist(A) length(A[A > 0])/10000
B <- replicate(10000,sum(rbinom(50,1,.05))) hist(B) length(B[B > 0])/10000
B. If the ineffectual experiment was conducted 20 times, and there were four groups, and the experimenter would accept a significant result from any of the orthogonal linear contrasts, what would be the probability of finding a significant result here? (1 point)
D <- replicate(10000,sum(rbinom(20,3,.05))) length(D[D > 0])/10000 hist(D)
library(tibble) my_pvalues <- c() for(i in 1:100){ IV <- rep(1:2,each=20) DV <- c(rnorm(20,0,1), rnorm(20,0,1)) sim_data <- tibble(IV,DV) my_pvalues[i] <- t.test(DV~IV, var.equal = TRUE, data= sim_data)$p.value t.test(DV~IV, var.equal= TRUE, data = sim_data) } hist(my_pvalues)
my_pvalues <- replicate(10000, t.test(rnorm(20,.5,1),rnorm(20,0,1), var.equal=TRUE)$p.value) hist(my_pvalues)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.